package com.fz.us.admin.company.entity;

import com.fz.us.admin.company.bean.EnumManage;

import javax.persistence.*;

/**
 * 实体类 - 职位
 * ============================================================================
 * 版权所有 2016 。
 *
 * @author fallenpanda
 * @version 1.0 2016-07-25 。
 * ============================================================================
 */
@Entity
@Table(name="sys_duty")
@AttributeOverride(name = "name", column = @Column(name = "name"))
public class Duty extends CompanyEntity {

    private static final long serialVersionUID = -435341122533507620L;

    public Duty() {
        super();
    }

    public Duty(User user, Power power) {
        super();
        this.user = user;
        this.power = power;
    }

    public Duty(User user, Power power, EnumManage.DutyState dutyState) {
        super();
        this.user = user;
        this.power = power;
        this.dutyState = dutyState;
    }
    /**
     * 用户
     */
    private User user;
    /**
     * 职权
     */
    private Power power;

    /**
     *职责情况
     */
    private EnumManage.DutyState dutyState;

    /**
     * 主要职位
     */
    private Integer ifMain;

    @ManyToOne(fetch = FetchType.LAZY)
    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    @ManyToOne(fetch = FetchType.LAZY)
    public Power getPower() {
        return power;
    }

    public void setPower(Power power) {
        this.power = power;
    }

    @Enumerated(EnumType.STRING)
    public EnumManage.DutyState getDutyState() {
        return dutyState;
    }

    public void setDutyState(EnumManage.DutyState dutyState) {
        this.dutyState = dutyState;
    }

    public Integer getIfMain() {
        return ifMain;
    }

    public void setIfMain(Integer ifMain) {
        this.ifMain = ifMain;
    }
}
